package day13.thread02;

/**
 * @author Xiao
 * @date 2021/8/5
 */
public class TicketDemo4 {
    /**
     * 同步方法：就是把synchronized关键字加到方法上
     * 格式：修饰符 synchronized 返回值类型 方法名(方法参数) {    }
     * 同步方法的锁对象：this
     */
    public static void main(String[] args) {
        Ticket4 t4 = new Ticket4();
        Thread t1 = new Thread(t4);
        Thread t2 = new Thread(t4);
        t1.setName("窗口1");
        t2.setName("窗口2");
        t1.start();
        t2.start();
    }
}
